Skip to content

fix: elements at fractional positions drawing on the wrong cells - #168

Merged
natemoo-re merged 4 commits into
mainfrom
fix/fractional-cell-coverage
Dec 3, 2026
Merged

natemoo-re merged 4 commits into
mainfrom
fix/fractional-cell-coverage

Conversation

@dreyfus92

@dreyfus92 dreyfus92 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

render coordinates used (int) casts, which truncate toward zero, so anything between y = -1 and 0 drew on row 0 (a panel sliding in from above stacked its rows there). now edges round with ceilf(v - 0.5) to the cell whose center they cover

the hit test needed one more piece to agree with that: clay's Clay__PointIsInsideRect includes both edges, so when an edge lands exactly on a cell center both elements get the pointer. this happens on plain odd grow() splits too (two siblings in 41 columns are 20.5 wide). patches/clay-half-open-hit-test.patch makes the bottom and right edges exclusive

added renderer-spec §7.11 (cell coverage) and pointed §12.4 at it. test/coverage.test.ts sweeps a panel from y = -3 to 1 and checks the pointer hits exactly the row drawn in every cell

heads up: fractional edges past the middle of a cell now round up instead of down, a 3-way split of 40 columns starts the third element at 27 instead of 26. no existing test changed

closes #151

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@bombshell-cooper

bombshell-cooper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Changeset present

This PR has an acceptable changeset.

Comment thread .changeset/large-geese-fix.md Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tty@168

commit: 5a9e8f0

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Size Reduced — -0.1 KB

141.1 KB unpacked

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me!

@natemoo-re
natemoo-re force-pushed the fix/fractional-cell-coverage branch from 307b7d0 to 5a9e8f0 Compare December 3, 2026 04:37
@natemoo-re
natemoo-re merged commit 0813fa4 into main Dec 3, 2026
12 checks passed
@natemoo-re
natemoo-re deleted the fix/fractional-cell-coverage branch December 3, 2026 04:38
@bombshell-bot bombshell-bot Bot mentioned this pull request Dec 3, 2026
natemoo-re added a commit that referenced this pull request Dec 4, 2026
Main landed void update() (#166), element replay (#171), the retained
frame pair (#169), cell coverage (#168), color encoding tiers (#148,
#157, #158), synchronized output (#139), and pointer shape (#137).

- update() can no longer return cleanup bytes, so resize and
  kitty-graphics denial enqueue wire image ids in a new fixed-capacity
  pending-deletion queue (§5.7); the next completed render emits the
  data-freeing deletions first (§9.2.6 step 0). Overflow collapses to
  one delete-all with transmission resets.
- removeImage() returns void and uses the same queue, resolving Open
  Decision 4: render() is the Term's only output path.
- Replay equivalence replaces snapshot equivalence; a replay carries
  the directive, never a resolution.
- Placements tables follow the frame pair's roles; INV-I9 maps onto
  discarding the current frame.
- Layout-box cell quantities are measured on the covered-cell rect
  (renderer-spec §7.11).
- img bg takes the full color value space; ascii art colors encode at
  the frame's color tier; a color-tier change re-places without
  re-transmitting.
- Graphics bytes sit inside the BSU/ESU pair; a graphics-only frame is
  not a no-op. §16.9 is dropped.
- Probe query renumbered to 10; §4.5 moved to §4.4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 elements at a negative fractional y draw on row 0 instead of being clipped

2 participants